package com.lkd.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lkd.entity.VendingMachineEntity;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author LKD
 */

public interface VendingMachineDao extends BaseMapper<VendingMachineEntity> {


  @Results(
          id = "vmResultMap",
          value = {
                  @Result(column = "vm_type",property = "vmType"),
                  @Result(column = "node_id",property = "nodeId"),
                  @Result(column = "region_id",property = "regionId"),
                  @Result(column = "vm_type",property = "type",one = @One(select =
                  "com.lkd.dao.VmTypeDao.selectById")),//类型
                  @Result(column = "node_id",property = "node",one = @One(select =
                  "com.lkd.dao.NodeDao.selectById")),//点位
                  @Result(column = "region_id",property = "region",one = @One(select =
                  "com.lkd.dao.RegionDao.selectById"))//区域
          }
  )
          @Select("select * from tb_dending_machine where id=#{id}")
    //查询某台售货机
    VendingMachineEntity findById(Long id);

            

    

}
